package com.szh.zx.gaoDingJavaBook.yitu.two;

public class TestException1 {
	public static void main(String[] args)  {
		SLT slt = new SLT();
		SLT slt1 = new SLT();
		SLT slt2 = new SLT();
		try {
			slt.close();
		} catch (Exception e) {
			e.printStackTrace();
		}
		try {
			slt2.close();
		} catch (Exception e) {
			e.printStackTrace();
		}
		try {
			slt1.close();
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}
class SLT{
	public void close() throws Exception {
		int x = (int) (Math.random()*2);
		if (x==1){
			throw  new Exception("手龙头没有关");
		}
		System.out.println("水龙头已经关了");
	}
}